<template>
  <div>
    <div class="up">
      <div class="head">项目新增</div>
    </div>
    <div class="message-box">
      <!-- 上区域 -->
      <div class="box-1">
        <div class="head2">项目基本信息</div>
        <!-- 获取项目名称 -->
        <div class="input-box1">
          <label class="head3" for="input">项目名称：</label>
          <el-input class="custom-input" v-model="projectName"></el-input>
        </div>
      </div>
      <!-- 中区域 -->
      <div class="box-2">
        <div class="block">
          <!-- 获取项目ID -->
          <div class="block-son">
            <label class="head5" for="input">项目类别：</label>
            <el-select class="down-input" v-model="projectType">
            </el-select>
          </div>
          <!-- 获取重要程度 -->
          <div class="block-son">
            <label class="head5" for="input">重要程度：</label>
            <el-select class="down-input" v-model="importantLevel">
            </el-select>
          </div>
          <!-- 获取项目名称 -->
          <div class="block-son">

          </div>
        </div>
        <div class="block">
          <!-- 获取开始时间 -->
          <div class="block-son">
            <label class="head5" for="input">开始时间：</label>
            <el-date-picker type="date" placeholder="选择日期" v-model="startDate" class="down-input"></el-date-picker>
          </div>
          <!-- 获取结束时间 -->
          <div class="block-son">
            <label class="head5" for="input">结束时间：</label>
            <el-date-picker type="date" placeholder="选择日期" v-model="endDate" class="down-input"></el-date-picker>
          </div>
          <div class="block-son"></div>
        </div>
        <div class="block">
          <!-- 获取预算 -->
          <div class="block-son">
            <div class="block-son">
              <label class="head5" for="input">预算：</label>
              <el-input class="down-input" v-model="budget" type="number"></el-input>
            </div>
          </div>
          <!-- 获取合同额 -->
          <div class="block-son">
            <div class="block-son">
              <label class="head5" for="input">合同额：</label>
              <el-input class="down-input" v-model="contractAmount" type="number"></el-input>
            </div>
          </div>
          <div class="block-son"></div>
        </div>
      </div>
      <!-- 下区域 -->
      <div class="box-3">
      </div>
    </div>
  </div>
</template>

<script>
// 引入展示项目概况的接口函数
import { getProject } from "@/api/index";

export default {
  name: "NewlyAdd2",
  data() {
    return {
      projectName: "zzz", // 项目基本信息的属性，初始值为空
      importantLevel: "important", // 项目的重要程度，单选框选择
      projectType: "high", // 项目类别
      budget: "100", // 预算
      contractAmount: "100", // 合同额
      startDate: "2024-07-07", // 开始时间
      endDate: "2024-07-07", // 结束时间
    };
  },
  methods: {
    fetchProjectData() {
      getProject()
        .then(response => {
          this.projectName = response.projectName;
          this.projectType = response.projectType;
          this.Level = response.importantLevel;
          this.budget = response.budget;
          this.contractAmount = response.contractAmount;
          this.startDate = response.startDate;
          this.endDate = response.endDate;
        })
        .catch(error => {
          console.error(error);
          this.$message.error("获取项目数据失败稍后再试");
        });
    },
    created() {
      this.fetchProjectData();
    },
  },
};
</script>

<style scoped>
a {
  text-decoration: none;
  /* 移除下划线 */
  color: inherit;
  /* 继承父元素的颜色 */
}

.custom-input {
  width: 75%;
}

.down-input {
  width: 50%;
  position: relative;
  left: 20px;
}

.head5 {
  border-color: rbg(215, 215, 215);
  color: rgb(51, 51, 51);
  font-size: 18px;
  margin-right: 10px;
  text-align: right;
  position: relative;
  left: 20px;
  widows: 90px;
  height: 24px;
}

.input-box1 {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  position: relative;
  top: 20px;
  left: 70px;
}

.head3 {
  border-color: rbg(215, 215, 215);
  color: rgb(51, 51, 51);
  font-size: 18px;
  margin-right: 10px;
  text-align: right;
}

.head4 {
  font-size: 18px;
  color: rgb(239, 233, 247);
  position: relative;
  top: -10px;
  left: 50px;
}

.head {
  font-family: "Arial", sans-serif;
  /* 设置字体 */
  font-weight: 700;
  /*加粗*/
  color: rgb(51, 51, 51);
  /* 设置颜色 */
  font-size: 28px;
  /* 设置字体大小 */
  box-sizing: border-box;
  margin-left: 20px;
  width: 150px;
  height: 46px;
  justify-content: space-between;
}

.head2 {
  font-family: "Arial", sans-serif;
  /* 设置字体 */
  font-weight: 700;
  /*加粗*/
  color: rgb(51, 51, 51);
  /* 设置颜色 */
  font-size: 20px;
  /* 设置字体大小 */
  position: relative;
  /* 设置定位 */
  top: 20px;
  /* 设置顶部位置 */
  left: 30px;
  /* 设置左侧位置 */
  box-sizing: border-box;
  width: 150px;
  height: 40px;
}

/*.background {
  display: flex;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(232, 232, 254);
  border: 2px solid rgb(206, 206, 207);
}*/
.back-add {
  background: aliceblue;
  border-radius: 5px;
  font-size: 24px;
  height: 80px;
  width: 50px;
  margin-right: 60px;
}

.up {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  height: 60px;
  justify-content: space-between;
}

.message-box {
  display: flex;

  background-color: rgb(255, 255, 255);

  height: 500px;
  top: 100px;
  left: -150px;
  flex-direction: column;
}

.box-1 {
  flex: 0 0 25%;
}

.box-2 {
  flex: 0 0 50%;
  display: flex;
}

.block {
  display: flex;
  width: 33.3%;

  flex-direction: column;
}

.block-son {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}</style>
